<% if current_user.pref2 == 'listed' -%>
<%= content_tag :div, "All open projects", :class => 'list_title'%>
	<% for project in @projects -%>
		<% content_tag :div, :class => 'container' do -%>
			<%= content_tag :img, nil,:src => '/images/icons/icons_27.png', :class => 'icon' %>
			<%= link_to( truncate(project.first_entry.name), { :action => :edit_project, :id => project.id }, :class => 'l1' ) -%>
			<%= content_tag :div, project.first_entry.status, :class => 'l3' -%>
		<% end -%>
	<% end -%>
<%= content_tag :div, 'All open actions', :class => 'list_title'%>
	<% for action in @actions -%>
	<% content_tag :div, :class => 'container' do -%>
		<%= content_tag :img, nil,:src => '/images/icons/icons_10.png', :class => 'icon' %>
			<%= link_to( truncate(action.first_entry.name), { :action => :edit, :id => action.id }, :class => 'l1' ) -%>
			<%= content_tag :div, action.first_entry.status, :class => 'l3' -%>
			<%= content_tag :div, time_ago_in_words(action.first_entry.due), :class => 'l2' -%>
		<% end -%>
	<% end -%>
<% elsif current_user.pref2 == 'nested' -%>
	<% for project in @projects -%>
		<% content_tag :div, :class => 'n0' do -%>
			<%= content_tag :img, nil,:src => '/images/icons/icons_27.png', :class => 'icon' %>
			<%= link_to project.first_entry.name, {:action => 'edit_project', :id => project.id} , :class => 'n1'%>
			<div class="n2"><%= render(:partial => 'partials/newaction', :locals => { :@project_id => project.id}) -%></div>
			<% content_tag :div, :class => 'n4' do -%>
				<%= content_tag :div, 'open actions', :class => 'ncsmall' %>
				<% content_tag :div, :class => 'nc' do -%>
					<% for action in ActionItem.find(:all, :conditions => ["project_id = ? AND status != 0", project.id],:order => "shead ASC") -%>
						<% content_tag :div, :class => 'ncc' do -%>
							<%= content_tag :img, nil, :src => '/images/icons/icons_12.png', :class => 'ni' %>
							<%= link_to( truncate(action.first_entry.name), { :action => :edit, :id => action.id }, :class => 'nl' ) -%>
							<%= content_tag :div, action.first_entry.assigned_to.login, :class => 'nr' -%>
							<%= content_tag :div, time_ago_in_words(action.first_entry.due), :class => 'nr' -%>
						<% end -%>
					<% end -%>
				<% end -%>
				<%= content_tag :div, 'completed actions', :class => 'ncsmall' %>
				<% content_tag :div, :class => 'nc' do -%>
					<% for action in ActionItem.find(:all, :conditions => ["project_id = ? AND status = 0", project.id],:order => "shead ASC") -%>
						<% content_tag :div, :class => 'ncc' do -%>
							<%= content_tag :img, nil, :src => '/images/icons/icons_11.png',:class => 'ni' %>
							<%= link_to( truncate(action.first_entry.name), { :action => :edit, :id => action.id }, :class => 'nl' ) -%>
						<% end -%>
					<% end -%>
				<% end -%>
			<% end -%>
		<% end -%>
	<% end -%>
<% else -%>
	<% for project in @projects -%>
		<% content_tag :div, :class => 'n0' do -%>
			<%= content_tag :img, nil,:src => '/images/icons/icons_10.png', :class => 'icon' %>
			<%= link_to project.first_entry.name, {:action => 'edit_project', :id => project.id} , :class => 'n1'%>
			<%= content_tag :div, truncate(project.first_entry.note,137), :class => 'n2'%>
			<div class="n2"><%= render(:partial => 'partials/newaction', :locals => { :@project_id => project.id}) -%></div>
			<% content_tag :div, :class => 'n4' do -%>
				<% if ActionItem.count(:conditions => ["project_id = ? AND status != 0", project.id]) > 0 -%>
					<%= content_tag :div, 'open actions', :class => 'ncsmall' %>
					<% content_tag :div, :class => 'nc' do -%>
						<% for action in ActionItem.find(:all, :conditions => ["project_id = ? AND status != 0", project.id],:order => "shead ASC") -%>
							<% content_tag :div, :class => 'ncc' do -%>
								<%= content_tag :img, nil, :src => '/images/icons/icons_12.png',:class => 'ni' %>
								<%= link_to( truncate(action.first_entry.name), { :action => :edit, :id => action.id }, :class => 'nl' ) -%>
								<%= content_tag :div, action.first_entry.assigned_to.login, :class => 'nr' -%>
								<%= content_tag :div, time_ago_in_words(action.first_entry.due), :class => 'nr' -%>
								<%= content_tag :div, truncate(action.first_entry.note, 124 ), :class => 'e1'%>
							<% end -%>
						<% end -%>
					<% end -%>	
				<% end -%>
				<% if ActionItem.count(:conditions => ["project_id = ? AND status != 0", project.id]) > 0 -%>
					<%= content_tag :div, 'completed actions', :class => 'ncsmall' %>
					<% content_tag :div, :class => 'nc' do -%>
						<% for action in ActionItem.find(:all, :conditions => ["project_id = ? AND status = 0", project.id],:order => "shead ASC") -%>
							<% content_tag :div, :class => 'ncc' do -%>
								<%= content_tag :img, nil,:src => '/images/icons/icons_11.png', :class => 'ni' %>
								<%= link_to( truncate(action.first_entry.name), { :action => :edit, :id => action.id }, :class => 'nl' ) -%>
							<% end -%>
						<% end -%>
					<% end -%>
				<% end -%>
			<% end -%>
		<% end -%>
	<% end -%>
<% end -%>